package com.xiaoxiang.pay.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: haha
 * @date: 2022/4/2 10:47
 */
@Configuration
public class AliPayConfig {

    @Value("${alipay.url}")
    private String url;

    @Value("${alipay.appid}")
    private String appid;

    @Value("${alipay.appPrivateKey}")
    private String appPrivateKey;

    @Value("${alipay.format}")
    private String format;

    @Value("${alipay.charset}")
    private String charset;

    @Value("${alipay.alipayPublicKey}")
    private String alipayPublicKey;

    @Value("${alipay.signType}")
    private String signType;

    @Bean
    public AlipayClient alipayClient() {
        return new DefaultAlipayClient(url, appid, appPrivateKey, format,
                charset, alipayPublicKey, signType);
    }
}
